package com.xr.enums;

/**
 * @author Arnold Yand
 * @summary 性别
 * @time 2018/3/24 17:56
 */
public enum Gender {

  UNKNOWN(0, "未知"),
  MALE(7, "男"),
  FEMALE(5, "女"),
  ;

  private int code;
  private String label;
  private Gender(int code, String label){
    this.code = code;
    this.label = label;
  }

  public Gender parse(int code){
    for(Gender v : Gender.values()){
      if(v.code == code){
        return v;
      }
    }
    return UNKNOWN;
  }
}
